import { Component, Input, ViewEncapsulation, ViewChild } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';

import { ToastService } from '../../shared/toast/toast.service';
import { ToastConfig, ToastType } from '../../shared/toast/toast-model';

/**
 * 修改名称组件
 */
@Component({
    selector: 'app-slideshows-rename',
    encapsulation: ViewEncapsulation.None,
    template: `
    <div class="container-fluid">
        <div class="modal-header">
            <h5 class="modal-title text-danger">{{modalTitle}}</h5>
            <button type="button" class="close" aria-label="Close" (click)="close()">
             <span aria-hidden="true">&times;</span>
            </button>
        </div>
        <div class="modal-body">
            <form>
                <div class="row">
                    <div class="col-md-9">
                        <div class="form-group row">
                            <label class="col-md-3 col-form-label text-right">标题：</label>
                            <div class="col-md-9">
                                <input name="modalText" type="text" [(ngModel)]="modalText" class="form-control" placeholder="请输入标题...">
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <div class="modal-footer">
            <div class="row">
                <div class="col-md-">
                    <button type="button" class="btn btn-primary" (click)="ok()">
                        <i class="fa fa-check" aria-hidden="true"></i> 确定
                    </button>
                    <button type="button" class="btn btn-light  c-ml15" (click)="close()">
                        <i class="fa fa-close" aria-hidden="true"></i> 关闭
                    </button>
                </div>
            </div>
        </div>

    </div>
    `
})
export class SlideshowsRenameComponent {

    @Input() modalTitle: string;
    @Input() modalText: string;

    constructor(public activeModal: NgbActiveModal, private toastService: ToastService) {

    }

    /**
     * 上传
     */
    ok(): void {
        this.activeModal.close(this.modalText);
    }

    /**
       * 关闭
       */
    close(): void {
        this.activeModal.dismiss({ status: 'closed' });
    }


}
